import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;


/**
 * 计算工作时间
 *
 * @author jianjianduan
 *
 * @date Jun 19, 2019
 */
public class CalcWorkTime {
    public static void main(String[] args) throws ParseException {
        System.out.println(getTime("9:38:00"));
    }





    public static String getTime(String strDate) throws ParseException{
        SimpleDateFormat s1 = new SimpleDateFormat("yyyy-MM-dd");
        if(strDate.length() < 10)
            strDate = s1.format(new Date()) + " " + strDate;
        SimpleDateFormat s2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = s2.parse(strDate);
        long diff = (System.currentTimeMillis() - date.getTime()) / (1000 * 60); // 分钟
        int hours = (int) diff / 60, mutine = (int) diff % 60;
        int remain = (int) (8.5*60- diff);
        int rh = remain / 60, rm = remain % 60;
        return hours + "小时" + mutine + "分" + "\n剩余： " + rh + "小时" + rm + "分钟";
    }
}